package com.roseski.util;

import java.security.SecureRandom;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OkHttpUtils {
	
	static Logger logger = LoggerFactory.getLogger(OkHttpUtils.class);
	
	public static SSLSocketFactory createSSLSocketFactory() {
		SSLSocketFactory ssfFactory = null;
		try {
	        SSLContext sc = SSLContext.getInstance("TLS");
	        sc.init(null, new TrustManager[]{new TrustAllCerts()}, new SecureRandom());
	
	        ssfFactory = sc.getSocketFactory();
		} catch (Exception e) {
			logger.error("createSSLSocketFactory():ERROR", e);
		}
		return ssfFactory;
	}
}
